/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.member;

import com.enation.app.javashop.client.member.MemberHistoryReceiptClient;
import com.enation.app.javashop.core.client.fallback.member.MemberReceiptFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.member.dos.ReceiptHistory;
import com.enation.app.javashop.model.member.vo.ReceiptHistoryVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 会员历史发票feign实现
 *
 * @author zh
 * @version v7.0
 * @date 18/7/31 下午5:08
 * @since v7.0
 */
@FeignClient(name = "member-service", fallbackFactory = MemberReceiptFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface MemberReceiptFeignImpl extends MemberHistoryReceiptClient {

    /**
     * 根据订单sn查询历史发票信息
     *
     * @param orderSn 订单sn
     * @return 历史发票信息
     */
    @Override
    @RequestMapping(value = "/client/members/receipt-history/{order_sn}", method = RequestMethod.GET)
    ReceiptHistoryVO getReceiptHistory(@PathVariable("order_sn") String orderSn);

    /**
     * 添加发票历史
     *
     * @param receiptHistory 发票历史
     * @return ReceiptHistory 发票历史
     */
    @Override
    @RequestMapping(value = "/client/members/receipt-history", method = RequestMethod.POST)
    ReceiptHistory add(@RequestBody ReceiptHistory receiptHistory);

    /**
     * 修改发票历史记录
     * @param receiptHistory
     * @return
     */
    @Override
    @RequestMapping(value = "/client/members/receipt-history/edit", method = RequestMethod.POST)
    ReceiptHistory edit(@RequestBody ReceiptHistory receiptHistory);

    /**
     * 修改该订单的发票的订单金额
     * @param orderPrice
     * @param orderSn
     */
    @Override
    @RequestMapping(value = "/client/members/receipt-history/update-price", method = RequestMethod.POST)
    void updatePriceByOrderSn(@RequestParam("order_price") Double orderPrice, @RequestParam("order_sn")String orderSn);
}
